import 'package:architecture/os_size.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

import '../../base/theme_controller.dart';
import 'setting_controller.dart';

class SettingPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return GetX<SettingController>(
        init: SettingController(),
        builder: (controller) {
          return Scaffold(
              backgroundColor: Colors.transparent,
              body: Container(
                padding: EdgeInsets.only(top: 15, left: 15),
                child: Column(
                  children: [
                    Row(
                      children: [
                        Text(
                          '开机自启动',
                          style: TextStyle(
                              color: isDarkMode.value
                                  ? Colors.white
                                  : Colors.black),
                        ),
                        SizedBox(
                          width: 10,
                        ),
                        Checkbox(
                            value: controller.isChecked.value,
                            onChanged: (value) {
                              controller.changeStatus();
                            })
                      ],
                    ),
                    Row(
                      children: [
                        Text(
                          '主题模式',
                          style: TextStyle(
                              color: isDarkMode.value
                                  ? Colors.white
                                  : Colors.black),
                        ),
                        Container(
                            width: windowWidth * 0.1,
                            height: 50,
                            child: RadioListTile<String>(
                                title: const Text('浅色'),
                                value: '浅色',
                                groupValue: controller
                                    .themeModes[isDarkMode.value ? 1 : 0],
                                onChanged: (String? newValue) {
                                  toggleTheme();
                                })),
                        Container(
                            width: windowWidth * 0.1,
                            height: 50,
                            child: RadioListTile<String>(
                                title: const Text('深色'),
                                value: '深色',
                                groupValue: controller
                                    .themeModes[isDarkMode.value ? 1 : 0],
                                onChanged: (String? newValue) {
                                  toggleTheme();
                                })),
                      ],
                    ),
                  ],
                ),
              ));
        });
  }
}
